So here is the solution I came up with. As JRR noted, my LAS tiles were not tiled correctly and this was due to previously re-projecting the single tiles which rotated them slightly and causing issues with the bounding box.
I wasn't able to do the re-tiling/re-projecting with only lidR so the solution I used was LAS2LAS to merge all the original un-projected LAS files into a single LAS file, project the new merged LAS, then use lidR for the rasterization for the whole area.
Hope this is useful for someone.
library(terra) # write raster files
library(lidR)
library(tictoc) #time script
library(hutils) # check if output folder exists and makes if not
# lastools path
exe_path_lastools <- "C:/LAStools/bin/"
# input/output
in_dir = "D:/las_folder/"
in_dir_filter = paste0(in_dir,"*.laz")
## ----------------------------------------------------------------------------
# set csr and convert to las v1.4 (larger point size limit per file)
# make single merged las file
## ----------------------------------------------------------------------------
# CRS projection
crs_code_src = 3006
crs_code_src_rh2000 = 5613
crs_code_target = 3011
out_dir = paste0(in_dir,"_",crs_code_target,.Platform$file.sep)
out_file_las = paste0(out_dir,.Platform$file.sep,"_merged.laz")
out_file_dem = paste0(out_dir,.Platform$file.sep,"_Haninge_DEM.tif")
# make output folder if it doenst exist
provide.dir(out_dir)
# lastools command
batchline_convert_las14 <- str_glue("{exe_path_lastools}las2las.exe -i {in_dir_filter} -keep_class 2 -set_version 1.4 -epsg {crs_code_src} -vertical_epsg {crs_code_src_rh2000} -target_epsg {crs_code_target} -target_elevation_meter -merged -o {out_file_las}")
# run lastools command
system(batchline_convert_las14)
toc()
print("las2las, done. starting rasterize terrain")
## ----------------------------------------------------------------------------
# make raster with lidr
## ----------------------------------------------------------------------------
# make dtm
las_data <- readLAS(out_file_las)
dtm <- rasterize_terrain(las_data, res = 1, tin())
# save dtm as raster
terra::writeRaster(dtm, out_file_dem, filetype = "GTiff", overwrite = TRUE)