I am facing an issue where capsule cast is not detecting a mesh collider. This happens in very narrow scenarios and by my estimate this is only occurring around intersection points between mesh colliders.
I have conducted various tests for this controller and it works perfectly in any other scenario apart for this. Example below of working properly.

I examined in detail any part of the code that could be responsible for this, but after quite some testing I can assure that the problem is arising due to collision not being detected by Capsule Cast. I expect the capsule cast to provide accurate collision information.
I examined the mesh import properties and mesh collider settings, I also fiddled with Physics settings but the problem still persists.
This is part of the code is responsible for Capsule Cast.
Vector3 GetCapsuleCylindricalLength()
{
return Vector3.up * (halfHeight - radius + skinWidth);
}
Vector3 CapsuleStart(Vector3 position) { return position + GetCapsuleCylindricalLength(); }
Vector3 CapsuleEnd(Vector3 position) { return position - GetCapsuleCylindricalLength(); }
float samplingRadius = radius - skinWidth;
float distance = velocity.magnitude + skinWidth;
Physics.CapsuleCast(capsuleStart, capsuleEnd, samplingRadius, velocity.normalized, out RaycastHit hit, distance, collisionMask)